<?php

class Person {
    
    public $name;

    public function __construct($name = '') {
        $this->name = $name;
    }
    
    public function eat($var) {
        echo $this->name . "吃饭" . $var;
    }
    
    public function sleep() {
        echo "睡觉";
    }
}

class Student extends Person {
    
    public function study() {
        echo "学习";
    }
}

$zhangsan = new Person("张三");
$zhangsan->eat("大盘鸡");
$zhangsan->study();

echo "<br />";
$lisi = new Student();
$lisi->eat("蛋炒饭");

